package bus_management;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;

public class connect{
	public static Connection connection;
	public static Statement statement;
    connect(){
    	String connectionUrl= "jdbc:mysql://pc-bp18rn0tqu85a1600-public.rwlb.rds.aliyuncs.com:3306/polardb_mysql_19624yqq";
    	try (Connection connection=DriverManager.getConnection(connectionUrl,"lab_397427012","90e3ab421ae7_#@Aa");
    			Statement s = connection.createStatement()) {
    		
               String selectSql = "SELECT * FROM `courses`";
               ResultSet resultSet = s.executeQuery(selectSql);
              
               
               while (resultSet.next()) {
                   System.out.println(resultSet.getString("name"));
               }
               
           }
           catch (SQLException e) {
               e.printStackTrace();
           }
    }
	public static void main(String args[]) {
		new connect(); 
		
    }
}